package game.block.trap;

import game.block.Locator;
import game.block.command.Command;
import game.block.command.WallMoveCommand;
import game.block.entity.MovableEntity;
import game.block.entity.TrapEntity;
import game.block.entity.Wall;
import game.block.game.Board;
import game.block.tile.Tile;
import game.block.turn.Turn;

import com.badlogic.gdx.math.Vector2;

public class WallTrigger extends TrapEntity {

    private int id;
    private Wall wall;
    
    public WallTrigger(Vector2 pos, Tile tile, int id) {
        super(pos, tile, HOLE, TRAPTYPE.TRIGGER);
        this.id=id;
    }

    public void setWall(Wall w){
        wall=w;
    }
    
    @Override
    public Command advance() {
        return null;
    }

    @Override
    public void applyEffect(MovableEntity block, Board gameBoard, Turn currentTurn, Tile tileMovedTo) {
        if (!block.counterEffect(this)) {
        	Locator.getAudio().playSound(SOUND.TRIGGER.getValue());
            currentTurn.addCommand(new WallMoveCommand(currentTile, gameBoard, wall, this));
        }
    }

    @Override
    public Command retract() {
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    
    @Override
	public void setInfo() {
		info="Name: Wall Move Trigger\nFunction: Makes a wall move";
	}

    
}
